package com.ruoyi.system.domain;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 采购单对象 purchase
 * 
 * @author ruoyi
 * @date 2023-12-27
 */
public class Purchase extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    public Purchase(){}
    public Purchase(String supplierID){
        this.supplierID = Integer.parseInt(supplierID);
        this.allPrice = BigDecimal.valueOf(0);
        this.purchaseID = null; // 或者根据需要设置一个初始值
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String currentDate = sdf.format(new Date());
        try {
            this.purchaseTime = sdf.parse(currentDate);
        } catch (ParseException e) {
            System.out.println(e);
        }

    }
    /** 采购单ID */
    private Long purchaseID;

    /** 采购总价 */
    @Excel(name = "采购总价")
    private BigDecimal allPrice;

    /** 采购单时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "采购单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date purchaseTime;

    public Integer getSupplierID() {
        return supplierID;
    }

    @Override
    public String toString() {
        return "Purchase{" +
                "purchaseID=" + purchaseID +
                ", allPrice=" + allPrice +
                ", purchaseTime=" + purchaseTime +
                ", supplierID=" + supplierID +
                ", supplierName='" + supplierName + '\'' +
                '}';
    }

    public void setSupplierID(Integer supplierID) {
        this.supplierID = supplierID;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    /**
     * 采购商ID
     */
    private Integer supplierID;

    @Excel(name = "采购商名称")
    private String supplierName;

    public void setPurchaseID(Long purchaseID) 
    {
        this.purchaseID = purchaseID;
    }

    public Long getPurchaseID() 
    {
        return purchaseID;
    }
    public void setAllPrice(BigDecimal allPrice) 
    {
        this.allPrice = allPrice;
    }

    public BigDecimal getAllPrice() 
    {
        return allPrice;
    }
    public void setPurchaseTime(Date purchaseTime) 
    {
        this.purchaseTime = purchaseTime;
    }

    public Date getPurchaseTime() 
    {
        return purchaseTime;
    }

}
